﻿Public Class frmSimulacaoStats

#Region "Funções"

    Private Sub CarregarComboBoxChampions()

        Dim objChampions As New Negocios.Champions

        cbbChampions.DataSource = objChampions.RetornarListaChampions()

    End Sub

    Public Sub ConfigurarTextos()

        lblSelecionar.Text = Resources.RetornarTextos("SelecionarChampion")
        tbpEstatisticas.Text = Resources.RetornarTextos("Estatisticas")
        Me.Text = Resources.RetornarTextos("SelecaoChampion")
        lblHealth.Text = Resources.RetornarTextos("StatusVida")
        lblResource.Text = Resources.RetornarTextos("StatusRecurso")
        lblMovementSpeed.Text = Resources.RetornarTextos("StatusMovementSpeed")
        lblArmor.Text = Resources.RetornarTextos("StatusArmor")
        lblMagicResist.Text = Resources.RetornarTextos("StatusMagicResist")
        lblResourceType.Text = Resources.RetornarTextos("StatusTipoRecurso")
        lblHealthRegen.Text = Resources.RetornarTextos("StatusRegeneracaoVida")
        lblResourceRegen.Text = Resources.RetornarTextos("StatusRegeneracaoRecurso")
        lblRange.Text = Resources.RetornarTextos("StatusRange")
        lblAttackDamage.Text = Resources.RetornarTextos("StatusAttackDamage")
        lblAttackSpeed.Text = Resources.RetornarTextos("StatusAttackSpeed")
        lblAbilityPower.Text = Resources.RetornarTextos("StatusAbilityPower")
        lblLevel.Text = Resources.RetornarTextos("Level")

        lblSubTitulo.Text = Resources.RetornarTituloChampion(Negocios.Champions.TrataNomeChampion(cbbChampions.Text))

    End Sub

    Private Sub CarregarChampion(ByVal objChampion As Objetos.Champion)

        Dim strNomeChampion As String = Negocios.Champions.TrataNomeChampion(objChampion.Nome)

        lblNome.Text = objChampion.Nome
        lblSubTitulo.Text = Resources.RetornarTituloChampion(strNomeChampion)
        picChampion.ImageLocation = Resources.RetornarImagemChampion(strNomeChampion)

        If Not String.IsNullOrEmpty(cbbLevel.SelectedValue) Then

            objChampion.Level = Convert.ToInt16(cbbLevel.SelectedValue)

            txtHealth.Text = String.Format("{0}", objChampion.HP_Base_Final)
            txtResource.Text = String.Format("{0}", objChampion.Recurso_Base_Final)
            txtMovementSpeed.Text = String.Format("{0}", objChampion.Movement_Speed_Base)
            txtArmor.Text = String.Format("{0}", objChampion.Armor_Base_Final)
            txtMagicResist.Text = String.Format("{0}", objChampion.Magic_Resist_Base_Final)
            txtResourceType.Text = String.Format("{0}", objChampion.Tipo_de_recurso)
            txtHealthRegen.Text = String.Format("{0}", objChampion.HP_Regen_Base_Final)
            txtResourceRegen.Text = String.Format("{0}", objChampion.Recurso_Regen_Base_Final)
            txtRange.Text = String.Format("{0}", objChampion.Range)
            txtAttackDamage.Text = String.Format("{0}", objChampion.Attack_Damage_Base_Final)
            txtAttackSpeed.Text = String.Format("{0}", objChampion.Attack_Speed_Base_Final)
            txtAbilityPower.Text = String.Format("{0}", objChampion.Ability_Power_Base_Final)

        End If

    End Sub

    Private Sub CarregarLevels()

        Dim lisLevels As New List(Of String)

        For i As Integer = 1 To 18
            lisLevels.Add(i)
        Next

        cbbLevel.DataSource = lisLevels

    End Sub

#End Region

#Region "Eventos"

    Private Sub frmSimulacaoStats_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ConfigurarTextos()
        CarregarComboBoxChampions()
        CarregarLevels()
    End Sub

    Private Sub cbbChampions_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbbChampions.SelectedIndexChanged

        Dim objChampion As Objetos.Champion = CType(cbbChampions.SelectedValue, Objetos.Champion)

        CarregarChampion(objChampion)

    End Sub

    Private Sub cbbLevel_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbbLevel.SelectedIndexChanged

        Dim objChampion As Objetos.Champion = CType(cbbChampions.SelectedValue, Objetos.Champion)

        CarregarChampion(objChampion)

    End Sub

#End Region

End Class